package sdk.io.grpc.hellostream.proto;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 * The greeting service definition.
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.31.0)",
    comments = "Source: hello_streaming.proto")
public final class HelloStreamingGreeterGrpc {

  private HelloStreamingGreeterGrpc() {}

  public static final String SERVICE_NAME = "sdk.io.grpc.hellostream.proto.HelloStreamingGreeter";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<sdk.io.grpc.hellostream.proto.HelloRequest,
      sdk.io.grpc.hellostream.proto.HelloResponse> getCallMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "call",
      requestType = sdk.io.grpc.hellostream.proto.HelloRequest.class,
      responseType = sdk.io.grpc.hellostream.proto.HelloResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
  public static io.grpc.MethodDescriptor<sdk.io.grpc.hellostream.proto.HelloRequest,
      sdk.io.grpc.hellostream.proto.HelloResponse> getCallMethod() {
    io.grpc.MethodDescriptor<sdk.io.grpc.hellostream.proto.HelloRequest, sdk.io.grpc.hellostream.proto.HelloResponse> getCallMethod;
    if ((getCallMethod = HelloStreamingGreeterGrpc.getCallMethod) == null) {
      synchronized (HelloStreamingGreeterGrpc.class) {
        if ((getCallMethod = HelloStreamingGreeterGrpc.getCallMethod) == null) {
          HelloStreamingGreeterGrpc.getCallMethod = getCallMethod =
              io.grpc.MethodDescriptor.<sdk.io.grpc.hellostream.proto.HelloRequest, sdk.io.grpc.hellostream.proto.HelloResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "call"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  sdk.io.grpc.hellostream.proto.HelloRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  sdk.io.grpc.hellostream.proto.HelloResponse.getDefaultInstance()))
              .setSchemaDescriptor(new HelloStreamingGreeterMethodDescriptorSupplier("call"))
              .build();
        }
      }
    }
    return getCallMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static HelloStreamingGreeterStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterStub>() {
        @java.lang.Override
        public HelloStreamingGreeterStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new HelloStreamingGreeterStub(channel, callOptions);
        }
      };
    return HelloStreamingGreeterStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static HelloStreamingGreeterBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterBlockingStub>() {
        @java.lang.Override
        public HelloStreamingGreeterBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new HelloStreamingGreeterBlockingStub(channel, callOptions);
        }
      };
    return HelloStreamingGreeterBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static HelloStreamingGreeterFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<HelloStreamingGreeterFutureStub>() {
        @java.lang.Override
        public HelloStreamingGreeterFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new HelloStreamingGreeterFutureStub(channel, callOptions);
        }
      };
    return HelloStreamingGreeterFutureStub.newStub(factory, channel);
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static abstract class HelloStreamingGreeterImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * Streams a many greetings
     * </pre>
     */
    public io.grpc.stub.StreamObserver<sdk.io.grpc.hellostream.proto.HelloRequest> call(
        io.grpc.stub.StreamObserver<sdk.io.grpc.hellostream.proto.HelloResponse> responseObserver) {
      return asyncUnimplementedStreamingCall(getCallMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getCallMethod(),
            asyncBidiStreamingCall(
              new MethodHandlers<
                sdk.io.grpc.hellostream.proto.HelloRequest,
                sdk.io.grpc.hellostream.proto.HelloResponse>(
                  this, METHODID_CALL)))
          .build();
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class HelloStreamingGreeterStub extends io.grpc.stub.AbstractAsyncStub<HelloStreamingGreeterStub> {
    private HelloStreamingGreeterStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected HelloStreamingGreeterStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new HelloStreamingGreeterStub(channel, callOptions);
    }

    /**
     * <pre>
     * Streams a many greetings
     * </pre>
     */
    public io.grpc.stub.StreamObserver<sdk.io.grpc.hellostream.proto.HelloRequest> call(
        io.grpc.stub.StreamObserver<sdk.io.grpc.hellostream.proto.HelloResponse> responseObserver) {
      return asyncBidiStreamingCall(
          getChannel().newCall(getCallMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class HelloStreamingGreeterBlockingStub extends io.grpc.stub.AbstractBlockingStub<HelloStreamingGreeterBlockingStub> {
    private HelloStreamingGreeterBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected HelloStreamingGreeterBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new HelloStreamingGreeterBlockingStub(channel, callOptions);
    }
  }

  /**
   * <pre>
   * The greeting service definition.
   * </pre>
   */
  public static final class HelloStreamingGreeterFutureStub extends io.grpc.stub.AbstractFutureStub<HelloStreamingGreeterFutureStub> {
    private HelloStreamingGreeterFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected HelloStreamingGreeterFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new HelloStreamingGreeterFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_CALL = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final HelloStreamingGreeterImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(HelloStreamingGreeterImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_CALL:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.call(
              (io.grpc.stub.StreamObserver<sdk.io.grpc.hellostream.proto.HelloResponse>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class HelloStreamingGreeterBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    HelloStreamingGreeterBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return sdk.io.grpc.hellostream.proto.HelloStreamProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("HelloStreamingGreeter");
    }
  }

  private static final class HelloStreamingGreeterFileDescriptorSupplier
      extends HelloStreamingGreeterBaseDescriptorSupplier {
    HelloStreamingGreeterFileDescriptorSupplier() {}
  }

  private static final class HelloStreamingGreeterMethodDescriptorSupplier
      extends HelloStreamingGreeterBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    HelloStreamingGreeterMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (HelloStreamingGreeterGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new HelloStreamingGreeterFileDescriptorSupplier())
              .addMethod(getCallMethod())
              .build();
        }
      }
    }
    return result;
  }
}
